const jwt = require('jwt-simple')
const KEY = 'webxxxx'
module.exports = {
  jwtEncode(payload) {
    return jwt.encode(
      {
        ...payload,
        expires: Date.now() + 1000 * 60 * 60 * 24,
      },
      KEY
    )
  },
  jwtDecode(token) {
    return jwt.decode(token, KEY)
  },
}
